package com.iptv.grape.event.imp;

import android.content.Intent;

import com.google.gson.Gson;
import com.iptv.grape.ApkMgrAct;
import com.iptv.grape.BaseActivity;
import com.iptv.grape.MyAct;
import com.iptv.grape.beans.ShowControlPanelBean;
import com.iptv.grape.event.JSRequest;
import com.iptv.grape.event.proc.IWebViewMessageProc;
import com.iptv.grape.util.SystemUtil;
import com.iptv.grape.video.XMediaPlayer;

public class ShowControlPanel implements IWebViewMessageProc {
    private String type;

    @Override
    public void init(JSRequest jsRequest) {

        ShowControlPanelBean bean = new Gson().fromJson(jsRequest.getJson(), ShowControlPanelBean.class);
        type = bean.data.type;
    }

    @Override
    public String procMessage(BaseActivity baseActivity, XMediaPlayer mediaPlayer) {
        Intent itent = new Intent();
        switch (type) {
            case "PlayLocally"://本地消息
                break;

            case "Bill": // 我的账单
                break;
            case "AppManagement"://应用管理
                itent.setClass(baseActivity, ApkMgrAct.class);
                baseActivity.startActivity(itent);
                break;
            case "SystemInfo"://系统信息
//                itent.setClass(baseActivity, SystemAct.class);
//                break;
            case "Account": //账号管理

//            case "SpeedUp": // 一键加速
//            case "NetworkTesting": // 网络测试
//            case "WasteCleaning": //垃圾清理
                itent.setClass(baseActivity, MyAct.class);
                itent.putExtra("TYPE", type);
                baseActivity.startActivity(itent);
                break;
            case "NetworkSettings": //网络设置
                SystemUtil.startNetSet(baseActivity);
                break;
        }

        return null;
    }
}
